home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / graph-3d.zip / GRAPH10.BAS < prev    next >
BASIC Source File  |  1989-04-23  |  1KB  |  40 lines

  1. 0 dim y(16),z(16):key off:screen 2
  2. 55 cls:locate 12,33:input "Dot density";dd$:dd=val(DD$):if dd=0 then dd=32
  3. 56 dd=dd/2:dx=1/4/dd
  4. 65 locate 14,30:print"Seclect Viewing Angle":print tab(30)"   0 degrees is from overheard":print tab(30)"  90 degrees is from the side"
  5. 66 locate 18,30:input "Angle in degrees";a$:a=val(a$):if a=0 then a=70
  6. 90 a=a*3.14159/180:s=sin(a):c=cos(a):cls
  7. 110 for i=0 to 7:for k=0 to 1:for j=0 to dd-1
  8. 115 max=-200:min=200:x=-4+i/2+k/4+j*dx:x1=int(30*x+.5):cc=16
  9. 116 for l=0 to 7:for n=1 to 2
  10. 118 if k=0 then f=(-1)^n*(dd-j)*dx else f=(-1)^n*j*dx
  11. 120 y=-3.75+l/2+f:gosub 1000
  12. 122 if y<-sqr(16-x*x) then 135
  13. 128 y(cc)=y:z(cc)=z:cc=cc-1
  14. 130 gosub 2000
  15. 135 next n,l
  16. 140 gosub 3000:next j,k,i
  17. 145 x1=0:min=200:max=-200
  18. 150 for i=-4 to 4 step .5:y=i:gosub 1000:gosub 2000:next i
  19. 175 sound 1000,2
  20. 180 t=timer:while t+1.5>timer:wend
  21. 185 if inkey$="" then 175
  22. 190 locate 25,1:print"Press <R>epeat or <E>xit";
  23. 195 a$=inkey$:if a$="R" or A$="r" then 55 else if a$<>"E" and a$<>"e" then 195
  24. 200 end
  25. 1000 r=sqr(x*x+y*y)
  26. 1010 z=1.5*(cos(r)-cos(3*r)/3)+.5
  27. 1020 return
  28. 2000 y=int(30*(c*y+s*z)+.5)
  29. 2005 if m=4 then 2050
  30. 2010 if y<min then min=y else 2050
  31. 2030 pset(320+x1,100-y)
  32. 2040 pset(320-x1,100-y)
  33. 2050 if y>max then max=y else return
  34. 2070 pset(320+x1,100-y)
  35. 2080 pset(320-x1,100-y)
  36. 2090 return
  37. 3000 for ii=cc+1 to 16:z=z(ii):y=-y(ii):gosub 2000:next ii:return
  38.  
  39.  
  40.